<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    html,body{
      width: 100%;
      height: 300%;
    }
  </style>
</head>

<body>
  <div id="app">
    <h1 @click="add">111111111111111111111</h1>
    <div v-for="item,index in str">{{item}}</div>
    <div v-for="item in arr">
      <span>姓名{{item.name}}</span><br>
      <span>年龄:{{item.age}}</span>
    </div>
  </div>
  <script src="../node_modules/vue/dist/vue.js"></script>
  <script>
    // v-for可以循环数组，字符串、数字、普通对象
    // 循环数组item是数组的每一项
    // 循环字符串，item是字符串的每一项
    // 循环数字，item是从1开始以此递增到数字的最大值
    // 循环对象，item是对象里每一个键值对的属性值
    let vm = new Vue({
      el: '#app',
      data: {
        ary: [100, 200, 300, 400],
        arr: [
          {
            name: 1,
            age: []
          },
          {
            name: 1,
            age: 18
          }
        ],
        str: { name: 1, age: 2, sex: 3 }
      },
      mounted(){

          window.addEventListener('scroll', function () {
              console.log(1)
          })
      },
      methods: {
        add() {
          console.log(window);
          // window.addEventListener('scroll', function () {
          //     console.log(1)
          // })
        }
      }
    })
  </script>
</body>

</html>